﻿using Nemerle;
using Nemerle.Assertions;
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;

using System;
using System.Collections.Generic;
using System.Linq;
using Nemerle2.Compiler;
using Microsoft.Cci;

namespace MetadataReader.CCI
{
  /// <summary>
  /// Description of CciEventInfo.
  /// </summary>
  class CciEventInfo : CciMemberInfo, IEventInfo
  {
    public this([NotNull] declType : CciTypeInfo, definition : IEventDefinition, index : int)
    {
      base(declType, definition, index);

      Adder   = CciMethodInfo(declType, definition.Adder.ResolvedMethod, index);
      Remover = CciMethodInfo(declType, definition.Remover.ResolvedMethod, index);
    }

    public sealed override MemberKind : MemberKind { get { MemberKind.Event } }

    private EventDefinition : IEventDefinition { get { Definition :> IEventDefinition } }

    public sealed override IsAbstract : bool { get { Adder.IsAbstract; } }
    public sealed override IsStatic   : bool { get { Adder.IsStatic } }

    public Adder   : Nemerle2.Compiler.IMethodInfo { get; private set; }
	  public Remover : Nemerle2.Compiler.IMethodInfo { get; private set; }

    public sealed override Type : Nemerle2.Compiler.FixedType
    {
    	get { Provider.GetType(EventDefinition.Type) }
    }

  }
}
